﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Imaginecup.factory;
using Imaginecup.recycling.Object.Entity;
using Imaginecup.sprite;
using Imaginecup.recycling.Behavior;

namespace Imaginecup.gameState.recycling.Sprite.Factory
{
    public enum SpriteID
    {
        NORMAL_SPRITE,
        ANIMATION_SPRITE,
        TOGGLE_SPRITE,
        IMAGE_TOGGLE_SPRITE
    }
    public class SpriteFactory
    {
        private static SpriteFactory Instance;
        private SpriteFactory()
        {

        }

        public static SpriteFactory GetInstance()
        {
            if (Instance == null)
                Instance = new SpriteFactory();

            return Instance;
        }

        public object GetObject(SpriteID ID, ObjectInfo info, object obj)
        {
            ISprite sprite = null;
            switch (ID)
            {
                case SpriteID.NORMAL_SPRITE:
                    sprite = new NormalSprite(info, (String)obj);
                    break;
                case SpriteID.ANIMATION_SPRITE:
                    sprite = new AnimationSprite(info, (IAnimationBehavior)obj);
                    break;
                case SpriteID.TOGGLE_SPRITE:
                    sprite = new ToggleSprite(info, (String)obj);
                    break;
                case SpriteID.IMAGE_TOGGLE_SPRITE:
                    sprite = new ImageToggleSprite(info, (String)obj, "ClickButton");
                    break;
            }

            return sprite;
        }
    }
}
